package cn.ml.gaoJi.jiHe.list.erChaShu;

public class MyLinked2 {
    private int count;
    private Xiang touXiang;
    private Xiang weiXiang;

    class Xiang{
        private String date;
        private Xiang nextXiang;
    }

    public void add(String str) {
        count++;
        Xiang xiang = new Xiang();
        xiang.date = str;
        if (touXiang == null) {
            touXiang = xiang;
        } else {
            weiXiang.nextXiang = xiang;
        }
        weiXiang = xiang;
    }

    public int size() {return count;}

    public String get(int i) {
        Xiang p = touXiang;
        for (int j=0;j<i;j++) {
            p = p.nextXiang;
        }
        return p.date;
    }

}
